import { Controller, Get } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
import { AppService } from './app.service';
import { ResponseDto } from './common/dto/response.dto';

/**
 * 应用主控制器
 * 提供基础的健康检查接口
 */
@ApiTags('应用')
@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Get()
  @ApiOperation({ summary: '获取应用信息' })
  @ApiResponse({
    status: 200,
    description: '成功获取应用信息',
    type: ResponseDto,
  })
  getHello(): ResponseDto<string> {
    const data = this.appService.getHello();
    return new ResponseDto(200, '获取成功', data);
  }

  @Get('health')
  @ApiOperation({ summary: '健康检查' })
  @ApiResponse({
    status: 200,
    description: '服务健康',
    type: ResponseDto,
  })
  healthCheck(): ResponseDto<{ status: string; timestamp: number }> {
    const data = this.appService.healthCheck();
    return new ResponseDto(200, '服务正常', data);
  }
}